<template>
	<view class="headlines">
		<view class="content">
			<view class="title">
				<!-- <text class="main">志愿头条</text> -->
				<u-image width="122" height="28" src="../../../../../static/top_news_name.png"></u-image>
				<text class="sub">更新于 {{handleDate(new Date(),"hh:mm")}}</text>
			</view>
			<view class="item" v-for="(item,index) in list" :key="item.id" @click="toDetail(item)">
				<text class="num">{{index+1}}</text>
				<text class="name">{{item.newsName}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		handleDate
	} from '@/utils/util.js'
	export default {
		components: {

		},
		props: {
			list: {
				type: Array,
				default: () => []
			},
		},
		data() {
			return {
			
			};
		},
		created() {
			// this.loadData();
		},
		methods: {
			handleDate,
		
			toDetail(item) {
				if (item.type == 0) {
					this.navigateTo({
						url: `/pages/main/news/detail/index?newsCode=${item.newsCode}`
					})
				} else {
					this.navigateTo({
						url: `/pages/main/news/detail/imageDetail?newsCode=${item.newsCode}`
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.headlines {
		width: 100%;
		padding: 20rpx;
		position: relative;

		.content {
			width: 100%;
			padding: 24rpx;
			background: #fff;
			display: flex;
			flex-direction: column;
			box-shadow: 0px 3rpx 10rpx 0rpx rgba(216, 216, 216, 0.49);
			// justify-content: flex-start;

			align-items: flex-start;

			.title {
				width: 100%;
				display: flex;
				align-items: center;
				margin-bottom: 26rpx;

				.main {
					font-size: 30rpx;
					font-weight: bolder;
					color: #FC1E0F;
					margin-right: 22rpx;
				}

				.sub {
					margin-left: 22rpx;
					font-size: 20rpx;
					font-weight: 400;
					color: #8C8C8C;
				}
			}

			.item {
				display: flex;
				margin-bottom: 19rpx;
				font-size: 26rpx;

				&:nth-last-child(1) {
					margin-bottom: 0;
				}

				&:nth-last-child(1) {
					>.num {
						color: #FF9000;
					}
				}

				&:nth-last-child(2) {
					>.num {
						color: #FD9153;
					}

				}

				&:nth-last-child(3) {
					>.num {
						color: #EB4D3C;
					}

				}

				.num {
					margin-right: 16rpx;
					font-weight: 500;
				}

				.name {
					width: 570rpx;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
					font-weight: 400;
					color: #333333;
					letter-spacing: 1rpx;


				}
			}
		}
	}
</style>
